# specify sample size
N = 2000
T = 25
K = 10

#-------------------------------------------------------------
# load data
#-------------------------------------------------------------
dataDir = "$(pwd())/data/"

# simul_data       = CSV.read(dataDir * "simul_data_final_Tlong.csv", DataFrame, header = true);
# densdraws_data   = CSV.read(dataDir * "simul_asset_data_final_Tlong.csv", DataFrame, header = false);
# employdraws_data = CSV.read(dataDir * "simul_employ_data_final_Tlong.csv", DataFrame, header = false);
#
# simul_data  = convert(Array,simul_data)
# densdraws   = convert(Array,densdraws_data)
# employdraws = convert(Array,employdraws_data)

simul_data  = readdlm(dataDir * "simul_data_final_Tlong.csv", ',', Float64, '\n'; skipstart=1)
densdraws   = readdlm(dataDir * "simul_asset_data_final_Tlong.csv", ',', Float64, '\n'; skipstart=0)
employdraws = readdlm(dataDir * "simul_employ_data_final_Tlong.csv", ',', Float64, '\n'; skipstart=0)

# subsequently use the same knots regardless of sample size N,T
knots_all = quantile(densdraws[employdraws.==1], quant_vec)
K_id      = findmin(abs.(vec(K.-K_vec)))[2]
knots     = knots_all[quant_sel[K_id,:].==1]

# aggregate data
agg_data = simul_data[1:T,1];
n_agg    = 1
